import Vue from 'vue'
import Vuex from 'vuex'
import App from './main'
import router from './router/count'
import createLogger from 'vuex/dist/logger'
// import Store from './store'
Vue.use(Vuex) 
var state = {
    count: 0
}

var mutations = {
    increment: function (state) {
        state.count++
    }
}

var actions = {
    increment: function (o) {
        o.commit('increment')
    }
}

var getters = {
    evenOrOdd: function (state) {
        return state.count % 2 === 0 ? 'even' : 'odd'
    }
}



var store = new Vuex.Store({
    state: state,
    getters: getters,
    actions: actions,
    mutations: mutations,
    plugins: [createLogger()]
})

new Vue({
    el: '#app',
    router,
    template: '<App/>',
    components: { App },
    store: store,
    computed: Vuex.mapGetters([
        'evenOrOdd'
    ]),
    methods: Vuex.mapActions([
        'increment'
    ])
})

/* eslint-disable no-new */
// new Vue({
//     el: '#app',
//     store: store,
//     router,
//     template: '<Main/>',
//     components: { Main },
//     computed: Vuex.mapGetters([
//         'evenOrOdd'
//     ]),
//     methods: Vuex.mapActions([
//         'increment'
//     ])
// })
